package com.cos.shop.dao.impl;

import com.cos.shop.dao.TypeDao;
import com.cos.shop.entity.Type;
import com.cos.shop.util.DBUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

/**
 * Copyright (C),2021-2022,亚瑟王
 * FileName: TypeDaoImpl
 * Author: saber
 * Date:2022/9/17 11:06
 */
public class TypeDaoImpl implements TypeDao {

    private QueryRunner qr = new QueryRunner(DBUtils.getDataSource());

    @Override
    public List<Type> getAll() throws SQLException {
        return qr.query("select * from type",new BeanListHandler<>(Type.class));
    }

}
